﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ACSkins.Controls.Forms
{
    public partial class ACSkinFormProgress : Form
    {
        public ACSkinFormProgress()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="MainTitle">主标题</param>
        /// <param name="SubTitle">子标题</param>
        public ACSkinFormProgress(string MainTitle, string SubTitle)
        {
            InitializeComponent();
            //主标题
            if (string.IsNullOrWhiteSpace(MainTitle))
            {
                TheMainTitle.Text = "";
            }
            else
            {
                TheMainTitle.Text = MainTitle;
            }
            //子标题
            if (string.IsNullOrWhiteSpace(SubTitle))
            {
                TheSubTitle.Text = "";
            }
            else
            {
                TheSubTitle.Text = SubTitle;
            }
            //局中
        }

        /// <summary>
        /// 设置数据
        /// </summary>
        /// <param name="MainTitle">主标题</param>
        /// <param name="SubTitle">子标题</param>
        /// <param name="PBValue">当前进度值</param>
        /// <param name="PBMax">最大进度值</param>
        public void SetValues(string MainTitle, string SubTitle, int PBValue, int PBMax)
        {
            this.Focus();
            TheMainTitle.Text = MainTitle;
            TheSubTitle.Text = SubTitle;
            this.Refresh();
            TheProgressBar.Maximum = PBMax;
            TheProgressBar.Value = PBValue;
        }

        /// <summary>
        /// 设置数据
        /// </summary>
        /// <param name="SubTitle">子标题</param>
        /// <param name="PBValue">当前进度值</param>
        /// <param name="PBMax">最大进度值</param>
        public void SetValues(string SubTitle,int PBValue,int PBMax)
        {
            this.Focus();
            if (!SubTitle.Equals(this.TheSubTitle.Text))
            {
                TheSubTitle.Text = SubTitle;
                this.Refresh();
            }
            
            TheProgressBar.Maximum = PBMax;
            TheProgressBar.Value = PBValue;
        }

        /// <summary>
        /// 设置数据
        /// </summary>
        /// <param name="SubTitle">子标题</param>
        /// <param name="PBValue">当前进度值</param>
        public void SetValues(string SubTitle,int PBValue)
        {
            this.Focus();
            TheSubTitle.Text = SubTitle;
            this.Refresh();
            TheProgressBar.Value = PBValue;
        }

        /// <summary>
        /// 设置进度条数值
        /// </summary>
        /// <param name="PBValue">当前进度值</param>
        /// <param name="PBMax">最大进度值</param>
        public void SetPBValues(int PBValue,int PBMax)
        {
            this.Focus();
            TheProgressBar.Maximum = PBMax;
            TheProgressBar.Value = PBValue;
        }

        /// <summary>
        /// 设置进度条数值
        /// </summary>
        /// <param name="PBValue">当前进度值</param>
        public void SetPBValue(int PBValue)
        {
            this.Focus();
            TheProgressBar.Value = PBValue;
        }

        /// <summary>
        /// 设置进度条数值
        /// </summary>
        /// <param name="PBMax">最大进度值</param>
        public void SetPBValueMax(int PBMax)
        {
            this.Focus();
            TheProgressBar.Maximum = PBMax;
        }

        /// <summary>
        /// 设置标题
        /// </summary>
        /// <param name="MainTitle">主标题</param>
        /// <param name="SubTitle">子标题</param>
        public void SetTValues(string MainTitle,string SubTitle)
        {
            this.Focus();
            TheMainTitle.Text = MainTitle;
            TheSubTitle.Text = SubTitle;
            this.Refresh();
        }

        /// <summary>
        /// 设置主标题
        /// </summary>
        /// <param name="MainTitle">主标题</param>
        public void SetTValuesMain(string MainTitle)
        {
            this.Focus();
            TheMainTitle.Text = MainTitle;
            this.Refresh();
        }

        /// <summary>
        /// 设置子标题
        /// </summary>
        /// <param name="SubTitle">子标题</param>
        public void SetTValuesSub(string SubTitle)
        {
            this.Focus();
            TheSubTitle.Text = SubTitle;
            this.Refresh();
        }

        /// <summary>
        /// 设置列表信息
        /// </summary>
        /// <param name="Message">信息</param>
        public void SetMessage(string Message)
        {
            this.Focus();
            lb_Msg.Items.Insert(0, Message);
            this.Refresh();
        }

        /// <summary>
        /// 设置清空列表信息
        /// </summary>
        public void SetMessageClear()
        {
            this.Focus();
            lb_Msg.Items.Clear();
        }
        

        private void TheMainTitle_TextChanged(object sender, EventArgs e)
        {
            this.Refresh();
        }

        private void TheSubTitle_TextChanged(object sender, EventArgs e)
        {
            this.Refresh();
        }
    }
}
